#ifndef _LOG_H_
#define _LOG_H_

#define LOG_MAX_BYTES LOG_ENTRIES*sizeof(log_row_t)	// max possible log row bytes

//Log file struct
typedef struct{
	log_row_t *rows;	// rows
	unsigned int size; 	// size
} logFile_t;

/*
 * function initLog
 * initialize the log file, must be the first to be called before any other log related function
 * returns 0 on failure to allocate memory, != 0 on success
 */ 
static int initLog(void);
/*
 * function writeLog
 * writes an entry to the log file. If the entry exists by conversation rules (params are equal and either side)
 * then the entry is updated with count+1, otherwise the entry is added
 * params: src_ip, src_port - source params -  ip and port
 * 		   dest_ip, dest_port - dest params - ip and port
 * 		   protocol - the packet protocol
 * 		   action - which action to be taken drop or accept from defined enum
 * 		   reason - reason for the action - from the defined enum
 * 		   hook num - hook number
 * returns 1 if updated or added, 0 if there is no more space for logging
 */					 
static int writeLog(unsigned int src_ip, unsigned int dst_ip, unsigned short src_port, unsigned short dst_port,unsigned char protocol, unsigned char action, signed int reason, unsigned char hooknum, unsigned char stringIndex);

/*
 * function clearLog
 * clears the log of all its entries and update size = 0
 */ 
static void clearLog(void);
//For debugging
//static void printLog(void);
#endif
